package tpase.StorageServer.VO;

public class Address {
    private String ip;
    private int port;

    // id is x, f(x)
    private byte[] id;

    @Override
    public int hashCode() {
        String s = ip + port;
        return s.hashCode();
    }

    @Override
    public String toString() {
        return "Address{" +
                "ip='" + ip + '\'' +
                ", port=" + port +
                '}';
    }

    @Override
    public boolean equals(Object obj) {
        Address address = (Address) obj;
        return this.ip.equals(address.ip) && this.port == address.port;
    }

    public Address() {
    }

    public Address(String ip, int port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public byte[] getId() {
        return id;
    }

    public void setId(byte[] id) {
        this.id = id;
    }
}
